<?php

namespace app\admin\controller\user_profile\userArchive\basicInfo;

use app\admin\service\user_profile\userArchive\basicInfo\BasicInfoService;
use app\BaseController;
use app\common\Message;

class BasicInfo extends BaseController
{
    use Message;

    /**
     * 导出基础资料
     * @return bool|string
     */
    public function exportBasicInfo(): bool|string
    {
        $param = $this->request->param();
        $param['uid'] = $this->userData['id'];
        $param['role_mode'] = $this->userData['role_mode'];
        $param['unit_id'] = $this->userData['unit_id'];
        try {
            $basicInfo = new BasicInfoService($this->app);
            if(!$basicInfo->exportBasicInfo($param)) throw new \Exception($basicInfo->getMessage());
            return success($basicInfo->getResult(),$basicInfo->getMessage());
        } catch (\Exception $e) {
            return error($e->getMessage(),$e->getCode(),[
                'line' => $e->getLine(),
                'file' => $e->getFile()
            ]);
        }
    }
}